package com.chenl.provider.DEMOS.缓存预热;

import com.chenl.provider.util.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

@Component
public class TeacherCache extends AbstractCache{
    @Autowired
    RedisService redisService;
    @Override
    public void initCache() {
        Map<String,String> map=new HashMap<>();
        for (int i = 20000; i < 30000; i++) {
            map.put("key"+i,String.valueOf(i));
        }
        long l = System.currentTimeMillis();
        for (Map.Entry<String, String> entry : map.entrySet()) {
//            redisService.set(entry.getKey(),entry.getValue());
        }
        long l2 = System.currentTimeMillis();
        long time=l2- l;
        System.out.println("非管道处理耗时："+time+"毫秒");
    }
}
